package LeedCode.twoSum;

import java.util.Scanner;

public class Main {
    public static int[] twoSum(int [] nums,int target){
        int [] index = new int [2];
        int i=0,j=nums.length-1,left,right;
        for (i=0;i<nums.length;i++){
            for (j=nums.length-1;j>i;j--){
                if (nums[i]+nums[j]==target){
                    index[0]=i;
                    index[1]=j;
                    break;
                }
            }
        }
        return index;
    }
    public static void main(String[] args){
        int [] nums={1,2,3,4,5,6};
        int [] text=twoSum(nums,6);
        for (int x: text){
            System.out.print(x+" ");
        }

    }
    
}
